{template '/web/_header'}
<script type="text/javascript" src="{UNPOR_BABY_LOCAL_STATIC}highcharts/highcharts.js"></script>
<!--主体内容-->
<div class="layui-body">
	<div class="layadmin-tabsbody-item layui-show">
    	<div class="layui-fluid">
    	{if $operation == 'index'}
    		<div class="layui-row layui-col-space15">
				<div class="layui-col-md12">
			    	<div class="layui-card">
			    		<div class="layui-card-header">数据概况（首页）</div>
			        	<div class="layui-card-body">
			          		<div class="layui-carousel layadmin-carousel layadmin-backlog" lay-anim="" lay-indicator="inside" lay-arrow="none" style="width: 100%; height: 280px;">
			            		<div carousel-item="">
			              			<ul class="layui-row layui-col-space10 layui-this">
			                			<li class="layui-col-xs6">
			                  				<a lay-href="app/content/comment" class="layadmin-backlog-body">
			                    			<h3>仓位总数</h3>
			                    			<p><cite>66</cite></p>
			                  				</a>
			                			</li>
			                			<li class="layui-col-xs6">
			                				<a lay-href="app/forum/list" class="layadmin-backlog-body">
			                    			<h3>门店总数</h3>
			                    			<p><cite>12</cite></p>
			                  				</a>
			                			</li>
			               				<li class="layui-col-xs6">
			                				<a lay-href="template/goodslist" class="layadmin-backlog-body">
			                    			<h3>今日订单</h3>
			                    			<p><cite>99</cite></p>
			                  				</a>
			                			</li>
			                			<li class="layui-col-xs6">
			                 				<a href="javascript:;" onclick="layer.tips('不跳转', this, {tips: 3});" class="layadmin-backlog-body">
			                				<h3>总订单</h3>
			                				<p><cite>20</cite></p>
			                  				</a>
			                			</li>
			              			</ul>
			              		</div>
			        		</div>
			      		</div>
			    	</div>
				</div>
				<div class="layui-col-md12">
			    	<div class="layui-card">
			    		<div class="layui-card-header">订单走势1111111</div>
			        	<!--<div class="layui-card-body">-->
			          		<!--111111-->
			      		<!--</div>-->



			    	</div>
				</div>

			</div>
		{elseif $operation == 'warehouse_index'}
			<div class="layui-row layui-col-space15">
				<div class="layui-col-md12">
			    	<div class="layui-card">
			    		<div class="layui-card-header">数据概况</div>
			        	<div class="layui-card-body">
			          		<div class="layui-carousel layadmin-carousel layadmin-backlog" lay-anim="" lay-indicator="inside" lay-arrow="none" style="width: 100%; height: 90px !important;">
			            		<div carousel-item="">
			              			<ul class="layui-row layui-col-space10 layui-this">
			                			<li class="layui-col-xs3">
			                				<a class="layadmin-backlog-body">
			                    			<h3>门店数量</h3>
			                    			<p><cite class="storeCount">0</cite></p>
			                  				</a>
			                			</li>
			               				<li class="layui-col-xs3">
			                				<a class="layadmin-backlog-body">
			                    			<h3>今日订单</h3>
			                    			<p><cite class="todayOrderCount">0</cite></p>
			                  				</a>
			                			</li>
			                			<li class="layui-col-xs3">
			                				<a class="layadmin-backlog-body">
			                    			<h3>今日订单额</h3>
			                    			<p><cite class="todayOrderPrice">0</cite></p>
			                  				</a>
			                			</li>
			                			<li class="layui-col-xs3">
			                 				<a class="layadmin-backlog-body">
			                				<h3>总订单</h3>
			                				<p><cite class="totalOrderCount">0</cite></p>
			                  				</a>
			                			</li>
			              			</ul>
			              		</div>
			        		</div>
			      		</div>
			    	</div>
				</div>
				<div class="layui-col-md12">
			    	<div class="layui-card">
			    		<div class="layui-card-header">订单走势</div>
			        	<div class="layui-card-body">
			          		<div id="orderView"></div>

			      		</div>
			    	</div>
				</div>

			</div>
			<script type="text/javascript">
				layui.use(['layer'], function(){
					var $=layui.jquery,
						layer=layui.layer,
						element = layui.element;
					var load;
					jQuery.ajax({
		                type: "post",
		                dataType: "json",
		                url: "{url 'index/index' array('op'=>'get_warehouse_data')}",
		                cache: false,
		                data: null,
		                beforeSend: function(){
		                	load = layer.load();
		                },
		                success: function(res){
		                    layer.close(load);
		                    $('.storeCount').text(res.result.storeCount);
		                    $('.todayOrderCount').text(res.result.todayOrderCount);
		                    $('.todayOrderPrice').text(res.result.todayOrderPrice);
		                    $('.totalOrderCount').text(res.result.totalOrderCount);
		                }
		            });
					var chart = Highcharts.chart('orderView', {
						credits: {
				    		enabled: false
						},
					    chart: {
					        type: 'line'
					    },
					    title: {
					        text: '近30天仓库订单概况'
					    },
					    xAxis: {
					        categories: [{loop $datas $key $row}{if $key>0},{/if}"{$row['date']}"{/loop}]
					    },
					    yAxis: {
					        title: {
					            text: '订单量',allowDecimals:false
					        }
					    },
					    plotOptions: {
					        line: {
					            dataLabels: {
					                // 开启数据标签
					                enabled: true          
					            },
					            // 关闭鼠标跟踪，对应的提示框、点击事件会失效
					            enableMouseTracking: false
					        }
					    },
					    series: [{
					        name: '每日订单',
					        data: [{loop $datas $key $row}{if $key>0},{/if}{$row['order_count']}{/loop}]
					    }]
					});
				})
				
			</script>
		{/if}
    	</div>
    </div>
</div>

{template 'web/_footer'}